﻿using System.Collections.Generic;
using System.Linq;

namespace ProgressTracker.Data.Entities
{
    public class Task
    {
        protected internal virtual ICollection<DayTask> DayTasks { get; set; }

        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
        public virtual bool Archived { get; set; }
        public virtual User User { get; set; }

        public Task()
        {
            DayTasks = new List<DayTask>();
        }

        public virtual bool IsCompleteForDay(Day day)
        {
            var dayTask = DayTasks.Where(x => x.Day.Id == day.Id).Single();

            return dayTask.TaskComplete;
        }
    }
}
